package ngocthien.game;
/**
 * The purpose of this class is to create text that can be used as a custom menu
 * It is used primarily in the Options class
 */
import org.anddev.andengine.entity.text.Text;
import org.anddev.andengine.opengl.font.Font;
 
public class MultiStateText extends Text{
        protected final int DEFAULT  = 0;
        protected final int ACTIVE   = 1;
        protected final int DISABLED = 2;
        protected int CURRENT_STATE  = DEFAULT;
        //Constructor takes the same inputs as the class it extends
        public MultiStateText(float pX, float pY, Font pFont, String pName) {
                super(pX, pY, pFont, pName);
        }
        
        protected boolean isActionOutside(final float pX, final float pY){
                if(pX < 0 || pX > this.getWidth()) return true;
                if(pY < 0 || pY > this.getHeight()) return true;
                return false;
        }
        protected void setState(final int pAction) {
                this.CURRENT_STATE = pAction;
        }
        protected boolean toggleState(){
                if(this.CURRENT_STATE == ACTIVE){
                        this.CURRENT_STATE = DEFAULT;
                        return false;
                } else {
                        this.CURRENT_STATE = ACTIVE;
                        return true;
                }
        }

        protected boolean isActive(){
                return (this.CURRENT_STATE == this.ACTIVE) ? true :  false;
        }
        protected boolean isEnabled(){
                return (this.CURRENT_STATE == this.DISABLED) ? false :  true;
        }
}
